<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>导入层架标签</title>
    <script src="js\Jquery3.1.1.js"></script>
    <script src="layui/layui.js" type="text/javascript" charset="utf-8"></script>
    <script src="layui/lay/modules/layer.js" type="text/javascript" charset="utf-8"></script>
    <link rel="stylesheet" type="text/css" href="layui/css/modules/layer/default/layer.css"/>
    <link rel="stylesheet" type="text/css" href="layui/css/layui.css"/>
</head>
<body style="background-color: #2C3E50;color: white;">
<fieldset class="layui-elem-field">
    <legend>数据初始化</legend>
    <div class="layui-field-box">
        <button type="button" class="layui-btn" id="test1">
            <i class="layui-icon">&#xe67c;</i>上传Excel表格数据
        </button>
        <hr class="layui-bg-red">
        请务必上传格式正确的Excell表格
    </div>
</fieldset>
<script>
    layui.use('upload', function () {
        var upload = layui.upload;
        //执行实例
        var uploadInst = upload.render({
            elem: '#test1' //绑定元素
            , url: 'upload' //上传接口
            , accept: 'file'
            , done: function (res) {
                //上传完毕回调
                layer.msg('上传成功', {icon: 1});
            }
            , error: function () {
                layer.msg('上传失败', {icon: 2});
            }

        });
    });
</script>
<script>
    var ip = "";
    var port = "";
    $.ajax({
        url: 'getIPandPort',
        async: false,
        success: function (res) {
            port = res.port;
            ip = res.ip;
        }
    });
    var ws = new WebSocket("ws://" + ip + ":" + port + "/sokect");
    ws.onopen = function () {
        console.log("连接成功")
    }
    ws.onmessage = function (evt) {


    };
    ws.onclose = function () {
        console.log("连接已关闭...")
    };
</script>
</body>
</html>